Method of executing a cryptographic protocol between two electronic entities

ABSTRACT

Perfected cryptographic protocol making it possible to counter attacks based on the analysis of the current consumption during the execution of a DES or similar.  
     According to the invention, a message (M) is processed by two entities (A and B) and the entity (B) subject to attack executes a chain of operations known as DES in which it is chosen to carry out a given operation (O 1 , O 2 , O 3  . . . O n )  
     or the same operation complemented ({overscore (O)} 1 , {overscore (O)} 2 , {overscore (O)} 3  . . . {overscore (O)} n ), the choice being random.

[0001] The invention relates to a method of executing a cryptographic protocol between two electronic entities, one of them being, for example but not exclusively, a smart card. The invention relates more particularly to a perfecting of the said protocol to prevent “attacks”, that is to say fraud attempts based on the analysis of the equipment whilst operating, in particular by means of measurements of the current consumption during the execution of such a cryptographic protocol initiated by a defrauder.

[0002] It is known that certain encrypted electronic entities, in particular microcircuit cards, are vulnerable to attacks based on the analysis of certain parameters during an operational phase. It is said that information can “leak” from a calculation made in the card, typically the execution of a cryptographic protocol initiated by the defrauder in possession of the card. The parameters analysed during the execution of such a protocol can be, typically, differences in computing time or electromagnetic radiations during the execution of the computation but, above all, the current consumption by the electronic entity for which an attempt is being made to break the code.

[0003] Thus, the conventional attack consists in causing the electronic entity which has fallen into the hands of the defrauder to execute a certain number of cryptographic protocols based on random messages, and therefore destined for failure, but having the consequence of having executed each time by the entity (the microcircuit card) a chain of operations known by the abbreviation DES (Data Encryption Standard) whilst analysing the current consumption during each execution of the said DES. The purpose of this attack is to discover the secret code of the said entity. As regards the DES, this is a well known algorithm, very widely used at present in the field of bank cards or that of access control cards.

[0004] By way of example, in the framework of a normal authentication between an entity A, for example a server, and an entity B, for example a microcircuit card in which the DES is programmed, the exchanges of information between the two entities are as follows:

[0005] the server A requests the card B to send a message, A and B being assumed to be in possession of the same key.

[0006] B sends any message and retains it in memory.

[0007] A applies the DES to the message using its key and returns the result to the card B.

[0008] At the same time, the card B applies the DES to the message which it has sent to the server A by making use of its own key. It obtains a result which is compared with that generated by the server A. If the two results are identical, the authentication is validated.

[0009] Furthermore, in the case of a fraud, that is to say in the case where the defrauder has the card and is seeking to determine the key, the defrauder can connect the card to a reader with which he will be able to transmit messages to it and connect it to means of recording the current consumption during the execution of the operations which it carries out.

[0010] On the basis of these simple means, the defrauder forms a system F which he connects to the card in place of the server A.

[0011] The process is then as follows. F requests a message from the card exactly as in the case of initialising an authentication. B sends this message. F sends another message to B presumed to be the result of treatment by the DES of the message sent by B. This message is of course incorrect. However, B makes use of its own key to execute a DES in order to obtain a result for the purpose of comparing it with the (incorrect) message sent by F. The result of this comparison is inevitably negative but the defrauder has succeeded in initiating the execution of a DES by B. During the execution of the said DES, the current consumption is detected and stored.

[0012] If F is capable of having a certain number of DES carried out by the card B, under the same conditions, and of storing the current consumption each time, it is possible to implement an attack whose principle is known. This attack, called “DPA” (Differential Power Analysis) makes it possible to reconstitute the secret key of the entity B.

[0013] The document WO 99163696 aims at countering attacks of this type by reducing the exploitable information capable of “leaking” during the execution of algorithms. In order to do this it suggests, in particular, introducing hazards in the cryptographic protocols in order to increase the number of cycles necessary in order to discover the secret key.

[0014] The invention proposes a precise parry to an attack of the “DPA” type by the random complementing of certain operations of the DES.

[0015] The invention applies more particularly to entities using the DES but it is also applicable, as will be seen below, to other entities (microcircuit cards) using algorithms other than the DES provided that the latter consists a succession of operations having certain properties which shall be explained later.

[0016] More precisely, the invention relates to a method of generating a cryptographic protocol between a first electronic entity and a second electronic entity subject to attack, according to which any message is generated, on the basis of which a chain of operations is carried by the said second entity resulting in the generation of a resultant or response message, the said response being compared with the result of another similar processing applied to the said message and carried out by the said first entity, characterised in that, at least in certain stages of the said chain of operations, the said second entity carries out either an operation of a chosen type or the same operation complemented, the choice depending on a random decision and in that the said response is constituted by the result of the last operation of the said chain, possibly complemented.

[0017] The complementing can be carried out either byte by byte, by doing the exclusive OR of the current byte randomly with one of the two hexadecimal values 00 and FF, or bit by bit, by processing the eight consecutive bits of the current byte together and doing the exclusive OR with a number chosen randomly, at each processed bite, from among the 256 hexadecimal values from 00 to FF.

[0018] Among the operations capable of being complemented may be quoted the operation called the exclusive OR or an operation of permutation of the bits of he message or of an intermediate result obtained whilst carrying out the said chain of operations, that is to say, according to the described example, after execution of a given operation of the DES. It is also possible to mention the operation of indexed access to a table or any operation which is stable in comparison with the application of the exclusive OR function, in particular the operation consisting in transferring the message or a previously mentioned intermediate result, from one location to another, of a storage space.

[0019] According to one possible embodiment, there is defined in the said second entity two chains of operations for the processing of the said message, one of the chains consisting of a series of data operations and the other chain consisting of a series of the same operations complemented and a final complementing and it is decided randomly to execute one of the two chains of operations on each reception of a message coming from the said first entity.

[0020] According to another embodiment, for the time being considered preferable, the method consists in using the said message or an intermediate result resulting from the execution of a preceding operation of the said chain, in applying a new operation of the said chain to it, or this same operation complemented, depending on the state of a random parameter associated with this new operation, in updating a complementing counter and in taking into account the state of this counter at the end of the execution of the said chain of operations in order to decide on the final configuration of the said response.

[0021] According to yet another advantageous variant, the method consists in using the said message, or an intermediate result of the execution of a preceding operation of the said chain, in applying to it a new operation of the said chain or this same operation complemented, depending on the state of a random parameter associated with this new operation and in transmitting, from operation to operation, information forming part of the said intermediate results, necessary for the final configuration of the said response.

[0022] Furthermore, it has been found that the difference between the number of times when the operations are carried out in a normal fashion and the number of times when they are carried out with complementing, during the execution of the DES or similar, must not be too great in order that the method may retain all of its efficiency with respect to the above-described attack. Consequently, the method is also noteworthy in that, whilst the said series of operations is being carried out, there is computed the difference between the number of times when the operations have been carried out in a normal fashion and the number of times when they have been carried out with complementing and in that the hazard is deleted on the decision to carry out operations in a normal or complemented manner, for a certain number of subsequent operations, when the said difference exceeds a predetermined value, in view of reducing the said difference.

[0023] The invention will be better understood and other of its advantages will appear more clearly in the light of the following description of a method of executing a cryptographic protocol according to its principle, given solely by way of example and referring to the appended drawings in which:

[0024]FIG. 1 is a diagram illustrating a part of the execution of cryptographic protocol, more precisely the execution of a DES programmed according to the invention; and

[0025]FIG. 2 is a diagram illustrating another way of executing the DES according to the invention.

[0026] Considering FIG. 1 more particularly, it is noted that the method of generating a cryptographic protocol between two electronic entities A and B, which is partially illustrated in the diagram, can be executed in one of these entities, typically in a smart card B when the latter is connected, for example, to a server A. The DES according to the invention is programmed in the smart card B. The latter also contains in its memory a secret key K which is capable of intervening in certain of the operations O₁, O₂, O₃ . . . O_(n) which concatenate during the execution of the DES. During the generation of the cryptographic protocol, the first entity (typically the said server A) requests the second entity (the card B) to send a message M. The message generated by B is any message: it is retained in memory in the card B. Whilst A processes this message with its own DES the card B applies the DES according to the invention to the message M which it has sent to the server A, making use of its own key K. In the example, the DES applied to the card B comprises two chains of operation. A first chain Ch₁ of operations O₁, O₂, O₃ . . . O_(n) corresponds to a conventional DES. The second chain Ch₂ of operations {overscore (O)}₁, {overscore (O)}₂, {overscore (O)}₃ . . . {overscore (O)}_(n) consists of the same succession of the same operations, but complemented. It is completed by a global complementing C of the result generated at the end of the last complemented operation {overscore (O)}_(n).

[0027] Furthermore, it is decided in a random manner to execute one or other of the two chains of operations at each generation of a said any message. This random choice is symbolised by a selector S_(a), interposed between the message M and each of the two chains of operations. The positioning of the selector is random, which means that each time a message M must be processed, one other of the two chains of operation Ch₁, Ch₂ is chosen in a random manner.

[0028] If the non-complemented chain has been chosen, the result given by the last operation O_(n) constitutes the response R which will be compared with the one which will have been generated by the server A. In the case where the chain of complemented operations has been selected, the result of the last operation {overscore (O)}_(n) is complemented and constitutes the response R.

[0029] In the embodiment shown in FIG. 2, a DES programmed according to the principle of the invention appears again, that is to say comprising the usual operations of a DES: O₁, O₂, O₃ . . . O_(n) or the similar complemented operations {overscore (O)}₁, {overscore (O)}₂, {overscore (O)}₃ . . . O_(n). The message itself can be complemented, that is to say used as it is at the start of the execution of the DES or in complemented form {overscore (M)}. The key K is used for the execution of at least certain operations. However, the selection of the operations, (that is to say the choice between the normal operation and its complemented version) is decided randomly from one operation to the next. In other words, the message M or an intermediate result resulting from the execution of a preceding operation O_(i), (or {overscore (O)}_(i)) is used, a new operation of the chain or its complemented version (that is to say O_(i+1) or {overscore (O_(i+1))}) is applied to it depending on the state of a random parameter associated with the new operation. This random parameter is generated by the selector S′_(a). Thus, by following the path of FIG. 2, it can been seen that it is the message M, as it is, which is used and not its complement {overscore (M)} (command 1 generated by S′_(a)) that it is the operation {overscore (O)}₁ which is selected (command 2) then the operation {overscore (O)}₂ (command 3), then the operation O₃ (command 4) and finally the sequence ends with the selection of the operation {overscore (O)}_(n) (command n). The result of the last operation, {overscore (O)}_(n) on this occasion, can constitute the result R or the complemented result {overscore (R)} which will be compared with another result generated by the entity A by using its own DES. The choice between R and {overscore (R)} is given by the state of a complementing counter C_(c) fed throughout the generation of the process by the selector S′_(a). In other words, the state of the complementing counter C_(c) makes it possible to know if it is necessary to validate the result R or its complement {overscore (R)} for the final configuration of the response to be compared with the computations of the entity A.

[0030] It should be noted that a variant makes it possible to eliminate the counter C_(c). It suffices to transmit, from operation to operation, information forming part of the intermediate results and representing the number of times when a DES operation has been executed in complemented form. In this case, the intermediate results transmitted from one operation to another themselves comprise the information equivalent to that finally given by the counter C_(c) in the embodiment shown in FIG. 2. In this case, the last intermediate result given by the execution of the operation O_(n) or {overscore (O)}_(n) is or is not complemented depending on a part of its own information which it contains. The final configuration of the response R is derived from it.

[0031] Returning to FIG. 1 or 2, it is noted that the selector S_(a) or S′_(a) is used for computing the difference between the number of times that the operations have been carried out in normal manner and the number of times they have been carried out with complementing. This difference d is stored and updated from operation to operation.

[0032] When the difference exceeds a predetermined value, which can reduce the efficiency of the method against the DPA attack, an order is generated which momentarily inhibits the selector S′_(a). In other words, the hazard is eliminated from the decision to carry out operations in the normal or complemented way, in order to execute a certain number of subsequent operations in the mode (normal or complemented) least used up to that point. The hazard is put back into use when the value of the difference d has been sufficiently reduced.

[0033] It is found that all of the operations of a conventional DES allow the implementation of the method according to one or other of the variants which have just been described.

[0034] By way of example, there will be mentioned below certain operations capable of being complemented and consequently compatible with the implementation of the method which has just been described.

[0035] An operation capable of being complemented is the operation known as the exclusive OR.

[0036] Another operation capable of being complemented is a known operation of permutation of the bits of the message M or of an intermediate result obtained on carrying out the chain of operations. For the permutations (simple, compressive or expansive), the permuted mask will advantageously be stored in memory.

[0037] Another operation capable of being complemented is the operation known as indexed access to a table.

[0038] Another operation capable of being complemented is the transfer of the message or of an intermediate result obtained whilst carrying out an operation of the chain, from one location to another of a storage space defined in the entity B. In practice, a mask is applied in a random manner by exclusive OR to the transferred data.

[0039] More generally, an operation capable of being complemented is a stable operation with respect to the application of the exclusive OR function, that is to say such that:

∀(x,y):f(x⊕y)=f(x)⊕f(y)

[0040] This is the case, among others, of the permutations and the transfer of data.

[0041] As mentioned above, a conventional DES consists of operations meeting the criteria defined above but the invention also applies to any algorithm carrying out a function analogous to that of a DES, provided that it consists of operations meeting the conditions given above.

[0042] Other operations of random nature can be combined with those which define the method described above. In particular, when several consecutive operations of the chain are commutative, it is possible to permute the order of their execution in a random manner. 

1. Method of generating a cryptographic protocol between a first electronic entity (A) and a second electronic entity (B) subject to attack, according to which any message (M) is generated, on the basis of which a chain of operations is carried by the said second entity resulting in the generation of a resultant or response message (R), the said response being compared with the result of another similar processing applied to the said message and carried out by the said first entity, characterised in that, at least in certain stages of the said chain of operations, the said second entity carries out either an operation of a chosen type (O₁, O₂, O₃ . . . O_(n)) or the same operation complemented ({overscore (O)}₁, {overscore (O)}₂, {overscore (O)}₃ . . . O_(n)), the choice depending on a random decision and in that the said response is constituted by the result of the last operation of the said chain, possibly complemented.
 2. Method according to claim 1 , characterised in that an operation capable of being complemented is the operation known as the exclusive OR.
 3. Method according to claim 1 or 2 , characterised in that an operation capable of being complemented is a known operation of permutation of the bits of the said message or of an intermediate result obtained on carrying out the said chain of operations.
 4. Method according to one of claims 1 to 3 , characterised in that an operation capable of being complemented is the operation known as indexed access to a table.
 5. Method according to one of claims 1 to 4 , characterised in that an operation capable of being complemented is a stable operation with respect to the application of the exclusive OR function.
 6. Method according to claim 5 , characterised in that an operation capable of being complemented is the transfer of the said message or of an intermediate result obtained whilst carrying out an operation of the said chain, from one location to another of a storage space.
 7. Method according to one of the preceding claims, characterised in that consists in using the said message or an intermediate result resulting from the execution of a preceding operation of the said chain, in applying a new operation of the said chain to it, or this same operation complemented, depending on the state of a random parameter (S′_(a)) associated with this new operation, in updating a complementing counter (C_(c)) and in taking into account the state of this counter at the end of the execution of the said chain of operations in order to decide on the final configuration of the said response.
 8. Method according to one of claims 1 to 6 , characterised in that consists in using the said message, or an intermediate result of the execution of a preceding operation of the said chain, in applying to it a new operation of the said chain or this same operation complemented, depending on the state of a random parameter (S′_(a)) associated with this new operation and in transmitting, from operation to operation, information forming part of the said intermediate results, necessary for the final configuration of the said response.
 9. Method according to one of claims 1 to 6 , characterised in that there is defined in the said second entity two chains of operations (Ch₁, Ch₂) for the processing of the said message, one of the chains consisting of a series of data operations and the other chain consisting of a series of the same operations complemented and a final complementing (C) and in that it is decided randomly to execute one of the two chains of operations on each reception of a said message
 10. Method according to one of the preceding claims, characterised in that, whilst the said series of operations is being carried out, there is computed the difference (d) between the number of times when the operations have been carried out in a normal fashion and the number of times when they have been carried out with complementing and in that the hazard (S′_(a)) is eliminated on the decision to carry out operations in a normal or complemented manner, in order to execute a certain number of subsequent operations, when the said difference exceeds a predetermined value, in the mode (normal or complemented) least used up to that point in view of reducing the said difference sufficiently.
 11. Method according to one of the preceding claims, characterised in that the complementing is carried out byte by byte.
 12. Method according to one of claims 1 to 10 , characterised in that the complementing is carried out bit by bit.
 13. Method according to one of the preceding claims, characterised in that, when several consecutive operations of the said chain are commutative, the order of their execution is permuted in a random manner. 